<%@include file="../taglibs.jsp" %>
<%@ page isErrorPage="true" import="org.apache.log4j.Logger" %>
<%@ page import="java.io.PrintWriter" %>
<stripes:layout-render name="../layout/baseview.jsp">
    <stripes:layout-component name="head">
        <jsp:element name="meta">
            <jsp:attribute name="name">
                <c:out value="description"/>
            </jsp:attribute>
            <jsp:attribute name="content">
                <fmt:message key="page.login.description"/>
            </jsp:attribute>
        </jsp:element>
        <jsp:element name="meta">
            <jsp:attribute name="name">
                <c:out value="keywords"/>
            </jsp:attribute>
            <jsp:attribute name="content">
                <fmt:message key="page.main.keywords"/>
            </jsp:attribute>
        </jsp:element>
        <title>
            <fmt:message key="page.login.pagetitle"/>
        </title>
    </stripes:layout-component>
    <stripes:layout-component name="content">
        <h1 style="color: red">Error</h1>
        <%
            Logger logger = Logger.getLogger("General Error");
            // unwrap ServletExceptions.
            while (exception instanceof ServletException) {
                exception = ((ServletException) exception).getRootCause();
            }

            // print stack trace.
            exception.printStackTrace(new PrintWriter(out));

            StringBuilder infoBuilder = new StringBuilder();
            infoBuilder.append(String.valueOf(exception));
            for (StackTraceElement el : exception.getStackTrace()) {
                infoBuilder.append("\nat ").append(el);
            }
            logger.error(infoBuilder.toString());
        %>
    </stripes:layout-component>
</stripes:layout-render>